package com.token.sysflow.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import com.token.sql.IntegrateSql;
import com.token.sql.AbstractTableBean;
/**
 * 流程信息
 * @author 代码创建
 */
public class FlowFlowInfo extends AbstractTableBean {

	private String FlowId; //流程ID
	private int SysId; //租户ID
	private String SysAddTime; //创建时间
	private String SysAddUser; //创建人
	private String SysEditTime; //修改时间
	private String SysEditUser; //修改人
	private String IsActive; //激活流程
	private String IsDefault; //默认流程
	private String FlowArea; //使用范围
	private String FlowName; //流程名称
	private String FlowVersion; //流程版本
	private String FlowDesc; //流程描述
	private String FlowCode; //流程编码
	private String FlowCode1; //yyyyMMdd
	private String FlowCode2; //流水号位数
	private String AppKeyId; //流程应用ID
	private String JsonNode; //节点数据

	public static String TABLE_NAME = "Flow_FlowInfo";
	public static String TABLEKEY_NAME = "FlowId";
	public FlowFlowInfo (IntegrateSql f){
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
	}

	public FlowFlowInfo (IntegrateSql f,ResultSet rs) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		this.initParamToRs(rs);
	}

	public FlowFlowInfo (IntegrateSql f,String keyValue) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		setCodePrepare(selectCodeById().toString());
		prepareSql.setPstValue(1, keyValue);
		ResultSet rs = executeQuery();
		if(rs.next()){
			initParamToRs(rs);
		}else{
			initParam();
		}
		rs.close();
	}

	@Override
	protected void initParam() {
		FlowId = ""; //流程ID
		SysId = 0; //租户ID
		SysAddTime = ""; //创建时间
		SysAddUser = ""; //创建人
		SysEditTime = ""; //修改时间
		SysEditUser = ""; //修改人
		IsActive = ""; //激活流程
		IsDefault = ""; //默认流程
		FlowArea = ""; //使用范围
		FlowName = ""; //流程名称
		FlowVersion = ""; //流程版本
		FlowDesc = ""; //流程描述
		FlowCode = ""; //流程编码
		FlowCode1 = ""; //yyyyMMdd
		FlowCode2 = ""; //流水号位数
		AppKeyId = ""; //流程应用ID
		JsonNode = ""; //节点数据
	}


	public void initParamToRs(ResultSet rs) throws SQLException{
		FlowId = rs.getString("FlowId"); //流程ID
		SysId = rs.getInt("SysId"); //租户ID
		SysAddTime = rs.getString("SysAddTime"); //创建时间
		SysAddUser = rs.getString("SysAddUser"); //创建人
		SysEditTime = rs.getString("SysEditTime"); //修改时间
		SysEditUser = rs.getString("SysEditUser"); //修改人
		IsActive = rs.getString("IsActive"); //激活流程
		IsDefault = rs.getString("IsDefault"); //默认流程
		FlowArea = rs.getString("FlowArea"); //使用范围
		FlowName = rs.getString("FlowName"); //流程名称
		FlowVersion = rs.getString("FlowVersion"); //流程版本
		FlowDesc = rs.getString("FlowDesc"); //流程描述
		FlowCode = rs.getString("FlowCode"); //流程编码
		FlowCode1 = rs.getString("FlowCode1"); //yyyyMMdd
		FlowCode2 = rs.getString("FlowCode2"); //流水号位数
		AppKeyId = rs.getString("AppKeyId"); //流程应用ID
		JsonNode = rs.getString("JsonNode"); //节点数据
		this.setKeyId(rs.getString("FlowId"));
	}


	@Override
	protected int appendData() throws SQLException {
		int i = 1;
		prepareSql.setPstValue(i++,FlowId); //流程ID
		prepareSql.setPstValue(i++,SysId); //租户ID
		prepareSql.setPstValue(i++,SysAddTime); //创建时间
		prepareSql.setPstValue(i++,SysAddUser); //创建人
		prepareSql.setPstValue(i++,SysEditTime); //修改时间
		prepareSql.setPstValue(i++,SysEditUser); //修改人
		prepareSql.setPstValue(i++,IsActive); //激活流程
		prepareSql.setPstValue(i++,IsDefault); //默认流程
		prepareSql.setPstValue(i++,FlowArea); //使用范围
		prepareSql.setPstValue(i++,FlowName); //流程名称
		prepareSql.setPstValue(i++,FlowVersion); //流程版本
		prepareSql.setPstValue(i++,FlowDesc); //流程描述
		prepareSql.setPstValue(i++,FlowCode); //流程编码
		prepareSql.setPstValue(i++,FlowCode1); //yyyyMMdd
		prepareSql.setPstValue(i++,FlowCode2); //流水号位数
		prepareSql.setPstValue(i++,AppKeyId); //流程应用ID
		prepareSql.setPstValue(i++,JsonNode); //节点数据
		return i;
	}


	@Override
	public Vector<String> getFields() {
		Vector<String> vec = new Vector<String>();
		vec.addElement("FlowId"); //流程ID
		vec.addElement("SysId"); //租户ID
		vec.addElement("SysAddTime"); //创建时间
		vec.addElement("SysAddUser"); //创建人
		vec.addElement("SysEditTime"); //修改时间
		vec.addElement("SysEditUser"); //修改人
		vec.addElement("IsActive"); //激活流程
		vec.addElement("IsDefault"); //默认流程
		vec.addElement("FlowArea"); //使用范围
		vec.addElement("FlowName"); //流程名称
		vec.addElement("FlowVersion"); //流程版本
		vec.addElement("FlowDesc"); //流程描述
		vec.addElement("FlowCode"); //流程编码
		vec.addElement("FlowCode1"); //yyyyMMdd
		vec.addElement("FlowCode2"); //流水号位数
		vec.addElement("AppKeyId"); //流程应用ID
		vec.addElement("JsonNode"); //节点数据
		return vec;
	}


	/**
	 * 设置流程ID
	 * @param flowid
	 */
	public void setFlowId(String flowid){
		FlowId = flowid;
	}
	/**
	 * 获取FlowId
	 * @return 流程ID
	 */
	public String getFlowId(){
		return FlowId;
	}

	/**
	 * 设置租户ID
	 * @param sysid
	 */
	public void setSysId(int sysid){
		SysId = sysid;
	}
	/**
	 * 获取SysId
	 * @return 租户ID
	 */
	public int getSysId(){
		return SysId;
	}

	/**
	 * 设置创建时间
	 * @param sysaddtime
	 */
	public void setSysAddTime(String sysaddtime){
		SysAddTime = sysaddtime;
	}
	/**
	 * 获取SysAddTime
	 * @return 创建时间
	 */
	public String getSysAddTime(){
		return SysAddTime;
	}

	/**
	 * 设置创建人
	 * @param sysadduser
	 */
	public void setSysAddUser(String sysadduser){
		SysAddUser = sysadduser;
	}
	/**
	 * 获取SysAddUser
	 * @return 创建人
	 */
	public String getSysAddUser(){
		return SysAddUser;
	}

	/**
	 * 设置修改时间
	 * @param sysedittime
	 */
	public void setSysEditTime(String sysedittime){
		SysEditTime = sysedittime;
	}
	/**
	 * 获取SysEditTime
	 * @return 修改时间
	 */
	public String getSysEditTime(){
		return SysEditTime;
	}

	/**
	 * 设置修改人
	 * @param sysedituser
	 */
	public void setSysEditUser(String sysedituser){
		SysEditUser = sysedituser;
	}
	/**
	 * 获取SysEditUser
	 * @return 修改人
	 */
	public String getSysEditUser(){
		return SysEditUser;
	}

	/**
	 * 设置激活流程
	 * @param isactive
	 */
	public void setIsActive(String isactive){
		IsActive = isactive;
	}
	/**
	 * 获取IsActive
	 * @return 激活流程
	 */
	public String getIsActive(){
		return IsActive;
	}

	/**
	 * 设置默认流程
	 * @param isdefault
	 */
	public void setIsDefault(String isdefault){
		IsDefault = isdefault;
	}
	/**
	 * 获取IsDefault
	 * @return 默认流程
	 */
	public String getIsDefault(){
		return IsDefault;
	}

	/**
	 * 设置使用范围
	 * @param flowarea
	 */
	public void setFlowArea(String flowarea){
		FlowArea = flowarea;
	}
	/**
	 * 获取FlowArea
	 * @return 使用范围
	 */
	public String getFlowArea(){
		return FlowArea;
	}

	/**
	 * 设置流程名称
	 * @param flowname
	 */
	public void setFlowName(String flowname){
		FlowName = flowname;
	}
	/**
	 * 获取FlowName
	 * @return 流程名称
	 */
	public String getFlowName(){
		return FlowName;
	}

	/**
	 * 设置流程版本
	 * @param flowversion
	 */
	public void setFlowVersion(String flowversion){
		FlowVersion = flowversion;
	}
	/**
	 * 获取FlowVersion
	 * @return 流程版本
	 */
	public String getFlowVersion(){
		return FlowVersion;
	}

	/**
	 * 设置流程描述
	 * @param flowdesc
	 */
	public void setFlowDesc(String flowdesc){
		FlowDesc = flowdesc;
	}
	/**
	 * 获取FlowDesc
	 * @return 流程描述
	 */
	public String getFlowDesc(){
		return FlowDesc;
	}

	/**
	 * 设置流程编码
	 * @param flowcode
	 */
	public void setFlowCode(String flowcode){
		FlowCode = flowcode;
	}
	/**
	 * 获取FlowCode
	 * @return 流程编码
	 */
	public String getFlowCode(){
		return FlowCode;
	}

	/**
	 * 设置yyyyMMdd
	 * @param flowcode1
	 */
	public void setFlowCode1(String flowcode1){
		FlowCode1 = flowcode1;
	}
	/**
	 * 获取FlowCode1
	 * @return yyyyMMdd
	 */
	public String getFlowCode1(){
		return FlowCode1;
	}

	/**
	 * 设置流水号位数
	 * @param flowcode2
	 */
	public void setFlowCode2(String flowcode2){
		FlowCode2 = flowcode2;
	}
	/**
	 * 获取FlowCode2
	 * @return 流水号位数
	 */
	public String getFlowCode2(){
		return FlowCode2;
	}

	/**
	 * 设置流程应用ID
	 * @param appkeyid
	 */
	public void setAppKeyId(String appkeyid){
		AppKeyId = appkeyid;
	}
	/**
	 * 获取AppKeyId
	 * @return 流程应用ID
	 */
	public String getAppKeyId(){
		return AppKeyId;
	}

	/**
	 * 设置节点数据
	 * @param jsonnode
	 */
	public void setJsonNode(String jsonnode){
		JsonNode = jsonnode;
	}
	/**
	 * 获取JsonNode
	 * @return 节点数据
	 */
	public String getJsonNode(){
		return JsonNode;
	}

}
